import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/loginView'
  },
  {
    path: '/loginView',
    name: 'loginView',
    component: () => import('@/views/loginView.vue')
  },
  {
    path: '/RegisterPage',
    name: 'RegisterPage',
    component: () => import('@/views/Register.vue')
  },
  {
    path: '/ForgetPwdPage',
    name: 'ForgetPwdPage',
    component: () => import('@/views/ForgetPwd.vue')
  },
  {
    path: '/system_mall',
    name: 'system_mall',
    component: () => import('@/views/system_mall.vue'),
    meta: {
      title: '系统商城'
    },
    redirect: '/system_mall/dashboard',
    children: [
      {
        path: 'Dashboard',
        component: () => import('@/modules/Dashboard.vue')
      },
      {
        path: 'GoodsManage',
        component: () => import('@/modules/GoodsManage.vue')
      },
      {
        path: 'OrderManage',
        component: () => import('@/modules/OrderManage.vue')
      },
      {
        path: 'UserManage',
        component: () => import('@/modules/UserManage.vue')
      }
    ]
  },

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
